import 'package:flutter/material.dart';
import 'package:one_flutter/main.dart';

//通用标题栏
class CommonBar extends StatelessWidget implements PreferredSizeWidget {
  var title;

  CommonBar({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: _MyAppBar(context, title),
    );
  }

  @override
  // TODO: implement preferredSize
  Size get preferredSize => Size.fromHeight(60);
}

//自定义标题栏
PreferredSizeWidget _MyAppBar(BuildContext context, String data) {
  return AppBar(
    title: new Text(data),
    leading: IconButton(
        icon: Icon(
          Icons.arrow_back,
          color: Colors.white,
        ),
        onPressed: () {
          Navigator.pop(context);
        }),
  );
}
